from django.conf.urls import url
from . import views

urlpatterns = [
    # 用户登录
    # 用户注册登录
    url(r'^register/$', views.RegisterView.as_view()),
    # 验证用户名是否重复
    # this.host + '/usernames/' + this.username + '/count/'
    url(r'^usernames/(?P<username>[a-zA-Z0-9_-]{5,20})/count/$', views.UsernameCountView.as_view()),
    # 验证手机号是否存在
    # this.host + '/mobiles/' + this.mobile + '/count/'
    url(r"^mobiles/(?P<mobile>1[3-9]\d{9})/count/$", views.UserMobileCountView.as_view()),
    # 登录用户
    url(r'^login/$', views.LoginView.as_view(), name='login'),
    # 用户登出操作
    url(r'^logout/$', views.LogOutView.as_view()),

    # 登录到用户中心
    # 用户登录到用户中心
    url(r'^info/$', views.User_Center_InfoView.as_view()),
    # 用户中心绑定email
    url(r'^emails/$', views.EmailView.as_view()),
    # 验证email
    url(r'^emails/verification/$', views.EmailActiveView.as_view()),

    # 收货地址页面
    url(r'^addresses/$', views.AddressView.as_view()),
    # 新建保存收货地址
    url(r'^addresses/create/$', views.CreateAddressView.as_view()),
    # 修改收货地址
    url(r'^addresses/(?P<address_id>\d+)/$', views.UpdateDestroyAddressView.as_view()),
    # 删除地址
    url(r'^addresses/(?P<address_id>\d+)/default/$', views.DefaultAddressView.as_view()),
    # 设置标题
    url(r'^addresses/(?P<address_id>\d+)/title/$', views.UpdateTitleAddressView.as_view()),
    # 修改密码
    url(r'^password/$', views.ChangePasswordView.as_view()),


]


